function varargout = MonmerGUI(varargin)
% MONMERGUI M-file for MonmerGUI.fig
%      MONMERGUI, by itself, creates a new MONMERGUI or raises the existing
%      singleton*.
%
%      H = MONMERGUI returns the handle to a new MONMERGUI or the handle to
%      the existing singleton*.
%
%      MONMERGUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in MONMERGUI.M with the given input arguments.
%
%      MONMERGUI('Property','Value',...) creates a new MONMERGUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before MonmerGUI_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to MonmerGUI_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help MonmerGUI

% Last Modified by GUIDE v2.5 19-Nov-2010 22:30:41

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @MonmerGUI_OpeningFcn, ...
                   'gui_OutputFcn',  @MonmerGUI_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before MonmerGUI is made visible.
function MonmerGUI_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to MonmerGUI (see VARARGIN)

% Choose default command line output for MonmerGUI
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes MonmerGUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = MonmerGUI_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --------------------------------------------------------------------
function File_Callback(hObject, eventdata, handles)
% hObject    handle to File (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)



function editNspex_Callback(hObject, eventdata, handles)
% hObject    handle to editNspex (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editNspex as text
%        str2double(get(hObject,'String')) returns contents of editNspex as a double


% --- Executes during object creation, after setting all properties.
function editNspex_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editNspex (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editNthe_Callback(hObject, eventdata, handles)
% hObject    handle to editNthe (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editNthe as text
%        str2double(get(hObject,'String')) returns contents of editNthe as a double


% --- Executes during object creation, after setting all properties.
function editNthe_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editNthe (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editNphim_Callback(hObject, eventdata, handles)
% hObject    handle to editNphim (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editNphim as text
%        str2double(get(hObject,'String')) returns contents of editNphim as a double


% --- Executes during object creation, after setting all properties.
function editNphim_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editNphim (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editDy_Callback(hObject, eventdata, handles)
% hObject    handle to editDy (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editDy as text
%        str2double(get(hObject,'String')) returns contents of editDy as a double


% --- Executes during object creation, after setting all properties.
function editDy_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editDy (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editPhiu_Callback(hObject, eventdata, handles)
% hObject    handle to editPhiu (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editPhiu as text
%        str2double(get(hObject,'String')) returns contents of editPhiu as a double


% --- Executes during object creation, after setting all properties.
function editPhiu_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editPhiu (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editGz_Callback(hObject, eventdata, handles)
% hObject    handle to editGz (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editGz as text
%        str2double(get(hObject,'String')) returns contents of editGz as a double


% --- Executes during object creation, after setting all properties.
function editGz_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editGz (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editTheu_Callback(hObject, eventdata, handles)
% hObject    handle to editTheu (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editTheu as text
%        str2double(get(hObject,'String')) returns contents of editTheu as a double


% --- Executes during object creation, after setting all properties.
function editTheu_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editTheu (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editGx_Callback(hObject, eventdata, handles)
% hObject    handle to editGx (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editGx as text
%        str2double(get(hObject,'String')) returns contents of editGx as a double


% --- Executes during object creation, after setting all properties.
function editGx_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editGx (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editDx_Callback(hObject, eventdata, handles)
% hObject    handle to editDx (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editDx as text
%        str2double(get(hObject,'String')) returns contents of editDx as a double


% --- Executes during object creation, after setting all properties.
function editDx_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editDx (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editDz_Callback(hObject, eventdata, handles)
% hObject    handle to editDz (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editDz as text
%        str2double(get(hObject,'String')) returns contents of editDz as a double


% --- Executes during object creation, after setting all properties.
function editDz_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editDz (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editGy_Callback(hObject, eventdata, handles)
% hObject    handle to editGy (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editGy as text
%        str2double(get(hObject,'String')) returns contents of editGy as a double


% --- Executes during object creation, after setting all properties.
function editGy_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editGy (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editIshape_Callback(hObject, eventdata, handles)
% hObject    handle to editIshape (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editIshape as text
%        str2double(get(hObject,'String')) returns contents of editIshape as a double


% --- Executes during object creation, after setting all properties.
function editIshape_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editIshape (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editSpinmt_Callback(hObject, eventdata, handles)
% hObject    handle to editSpinmt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editSpinmt as text
%        str2double(get(hObject,'String')) returns contents of editSpinmt as a double


% --- Executes during object creation, after setting all properties.
function editSpinmt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editSpinmt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --------------------------------------------------------------------
function OpenParam_Callback(hObject, eventdata, handles)
% hObject    handle to OpenParam (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

global nspex  ishape  nthe  nphim  theu  phiu
global gx  gy  gz  dx  dy  dz  spinm  axa  aya  aza  niso  wgt
global pop  arat  nnit  npro  axb  ayb  azb
global gxt  gyt  gzt  dxt  dyt  dzt  spinmt  axat  ayat  azat
global popt  aratt  nnitt  nprot  axbt  aybt  azbt  nisot  wgtt  theut  phiut
global isaveh  ilin  iiso
global flx  fly  flz  flxt  flyt  flzt  bwidemax
    
% Open a fileChooser to get the parameter file
filep = uigetfile({'*.PAR'; '*.par'}, 'Enter Parameter File');
if filep == 0
  return
end

disp(filep);


% update the GUI with the selected filename
set(handles.paramFileName, 'String', filep);

% load parameters from file, check if there was an error
if parain(filep) == 0
  % There was an error, clear the entry and return
  set(handles.paramFileName, 'String', '');
  return
end

% Populate the GUI with the parameters
set(handles.editNspex, 'String', nspex);
set(handles.editIshape, 'String', ishape);
set(handles.editNthe, 'String', nthe);
set(handles.editNphim, 'String', nphim);
set(handles.editTheu, 'String', theu);
set(handles.editPhiu, 'String', phiu);
set(handles.editGx, 'String', gx);
set(handles.editGy, 'String', gy);
set(handles.editGz, 'String', gz);
set(handles.editDx, 'String', dx);
set(handles.editDy, 'String', dy);
set(handles.editDz, 'String', dz);
set(handles.editSpinm, 'String', spinm);
set(handles.editAxa, 'String', axa);
set(handles.editAya, 'String', aya);
set(handles.editAza, 'String', aza);
set(handles.editIsaveh, 'String', isaveh);
set(handles.editNiso, 'String', niso);
set(handles.editWgt, 'String', wgt);
set(handles.editNpro, 'String', npro);
set(handles.editNnit, 'String', nnit);
set(handles.editAxb, 'String', axb);
set(handles.editAyb, 'String', ayb);
set(handles.editAzb, 'String', azb);
set(handles.editGxt, 'String', gxt);
set(handles.editGyt, 'String', gyt);
set(handles.editGzt, 'String', gzt);
set(handles.editDxt, 'String', dxt);
set(handles.editDyt, 'String', dyt);
set(handles.editDzt, 'String', dzt);
set(handles.editSpinmt, 'String', spinmt);
set(handles.editAxat, 'String', axat);
set(handles.editAyat, 'String', ayat);
set(handles.editAzat, 'String', azat);
set(handles.editPopt, 'String', popt);
set(handles.editAratt, 'String', aratt);
set(handles.editNnitt, 'String', nnitt);
set(handles.editNprot, 'String', nprot);
set(handles.editAxbt, 'String', axbt);
set(handles.editAybt, 'String', aybt);
set(handles.editAzbt, 'String', azbt);
set(handles.editNisot, 'String', nisot);
set(handles.editWgtt, 'String', wgtt);
set(handles.editTheut, 'String', theut);
set(handles.editPhiut, 'String', phiut);
set(handles.editIsaveh, 'String', isaveh);
set(handles.editIlin, 'String', ilin);
set(handles.editIiso, 'String', iiso);
set(handles.editFlx, 'String', flx);
set(handles.editFly, 'String', fly);
set(handles.editFlz, 'String', flz);
set(handles.editFlxt, 'String', flxt);
set(handles.editFlyt, 'String', flyt);
set(handles.editFlzt, 'String', flzt);
set(handles.editBwidemax, 'String', bwidemax);

fclose('all');




function editAxat_Callback(hObject, eventdata, handles)
% hObject    handle to editAxat (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editAxat as text
%        str2double(get(hObject,'String')) returns contents of editAxat as a double


% --- Executes during object creation, after setting all properties.
function editAxat_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAxat (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editAyat_Callback(hObject, eventdata, handles)
% hObject    handle to editAyat (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editAyat as text
%        str2double(get(hObject,'String')) returns contents of editAyat as a double


% --- Executes during object creation, after setting all properties.
function editAyat_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAyat (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editAzat_Callback(hObject, eventdata, handles)
% hObject    handle to editAzat (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editAzat as text
%        str2double(get(hObject,'String')) returns contents of editAzat as a double


% --- Executes during object creation, after setting all properties.
function editAzat_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAzat (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editPopt_Callback(hObject, eventdata, handles)
% hObject    handle to editPopt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editPopt as text
%        str2double(get(hObject,'String')) returns contents of editPopt as a double


% --- Executes during object creation, after setting all properties.
function editPopt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editPopt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editAratt_Callback(hObject, eventdata, handles)
% hObject    handle to editAratt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editAratt as text
%        str2double(get(hObject,'String')) returns contents of editAratt as a double


% --- Executes during object creation, after setting all properties.
function editAratt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAratt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editNnitt_Callback(hObject, eventdata, handles)
% hObject    handle to editNnitt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editNnitt as text
%        str2double(get(hObject,'String')) returns contents of editNnitt as a double


% --- Executes during object creation, after setting all properties.
function editNnitt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editNnitt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editNprot_Callback(hObject, eventdata, handles)
% hObject    handle to editNprot (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editNprot as text
%        str2double(get(hObject,'String')) returns contents of editNprot as a double


% --- Executes during object creation, after setting all properties.
function editNprot_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editNprot (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editAxbt_Callback(hObject, eventdata, handles)
% hObject    handle to editAxbt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editAxbt as text
%        str2double(get(hObject,'String')) returns contents of editAxbt as a double


% --- Executes during object creation, after setting all properties.
function editAxbt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAxbt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editAybt_Callback(hObject, eventdata, handles)
% hObject    handle to editAybt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editAybt as text
%        str2double(get(hObject,'String')) returns contents of editAybt as a double


% --- Executes during object creation, after setting all properties.
function editAybt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAybt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editAzbt_Callback(hObject, eventdata, handles)
% hObject    handle to editAzbt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editAzbt as text
%        str2double(get(hObject,'String')) returns contents of editAzbt as a double


% --- Executes during object creation, after setting all properties.
function editAzbt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAzbt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editNisot_Callback(hObject, eventdata, handles)
% hObject    handle to editNisot (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editNisot as text
%        str2double(get(hObject,'String')) returns contents of editNisot as a double


% --- Executes during object creation, after setting all properties.
function editNisot_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editNisot (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editWgtt_Callback(hObject, eventdata, handles)
% hObject    handle to editWgtt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editWgtt as text
%        str2double(get(hObject,'String')) returns contents of editWgtt as a double


% --- Executes during object creation, after setting all properties.
function editWgtt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editWgtt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editTheut_Callback(hObject, eventdata, handles)
% hObject    handle to editTheut (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editTheut as text
%        str2double(get(hObject,'String')) returns contents of editTheut as a double


% --- Executes during object creation, after setting all properties.
function editTheut_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editTheut (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editPhiut_Callback(hObject, eventdata, handles)
% hObject    handle to editPhiut (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editPhiut as text
%        str2double(get(hObject,'String')) returns contents of editPhiut as a double


% --- Executes during object creation, after setting all properties.
function editPhiut_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editPhiut (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editIsaveh_Callback(hObject, eventdata, handles)
% hObject    handle to editIsaveh (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editIsaveh as text
%        str2double(get(hObject,'String')) returns contents of editIsaveh as a double


% --- Executes during object creation, after setting all properties.
function editIsaveh_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editIsaveh (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editIlin_Callback(hObject, eventdata, handles)
% hObject    handle to editIlin (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editIlin as text
%        str2double(get(hObject,'String')) returns contents of editIlin as a double


% --- Executes during object creation, after setting all properties.
function editIlin_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editIlin (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editFlx_Callback(hObject, eventdata, handles)
% hObject    handle to editFlx (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editFlx as text
%        str2double(get(hObject,'String')) returns contents of editFlx as a double


% --- Executes during object creation, after setting all properties.
function editFlx_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editFlx (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editIiso_Callback(hObject, eventdata, handles)
% hObject    handle to editIiso (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editIiso as text
%        str2double(get(hObject,'String')) returns contents of editIiso as a double


% --- Executes during object creation, after setting all properties.
function editIiso_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editIiso (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editFly_Callback(hObject, eventdata, handles)
% hObject    handle to editFly (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editFly as text
%        str2double(get(hObject,'String')) returns contents of editFly as a double


% --- Executes during object creation, after setting all properties.
function editFly_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editFly (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editFlz_Callback(hObject, eventdata, handles)
% hObject    handle to editFlz (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editFlz as text
%        str2double(get(hObject,'String')) returns contents of editFlz as a double


% --- Executes during object creation, after setting all properties.
function editFlz_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editFlz (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editFlxt_Callback(hObject, eventdata, handles)
% hObject    handle to editFlxt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editFlxt as text
%        str2double(get(hObject,'String')) returns contents of editFlxt as a double


% --- Executes during object creation, after setting all properties.
function editFlxt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editFlxt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editFlzt_Callback(hObject, eventdata, handles)
% hObject    handle to editFlzt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editFlzt as text
%        str2double(get(hObject,'String')) returns contents of editFlzt as a double


% --- Executes during object creation, after setting all properties.
function editFlzt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editFlzt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editFlyt_Callback(hObject, eventdata, handles)
% hObject    handle to editFlyt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editFlyt as text
%        str2double(get(hObject,'String')) returns contents of editFlyt as a double


% --- Executes during object creation, after setting all properties.
function editFlyt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editFlyt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editBwidemax_Callback(hObject, eventdata, handles)
% hObject    handle to editBwidemax (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editBwidemax as text
%        str2double(get(hObject,'String')) returns contents of editBwidemax as a double


% --- Executes during object creation, after setting all properties.
function editBwidemax_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editBwidemax (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editAxb_Callback(hObject, eventdata, handles)
% hObject    handle to editAxb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editAxb as text
%        str2double(get(hObject,'String')) returns contents of editAxb as a double


% --- Executes during object creation, after setting all properties.
function editAxb_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAxb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editAyb_Callback(hObject, eventdata, handles)
% hObject    handle to editAyb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editAyb as text
%        str2double(get(hObject,'String')) returns contents of editAyb as a double


% --- Executes during object creation, after setting all properties.
function editAyb_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAyb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editAzb_Callback(hObject, eventdata, handles)
% hObject    handle to editAzb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editAzb as text
%        str2double(get(hObject,'String')) returns contents of editAzb as a double


% --- Executes during object creation, after setting all properties.
function editAzb_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAzb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editNiso_Callback(hObject, eventdata, handles)
% hObject    handle to editNiso (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editNiso as text
%        str2double(get(hObject,'String')) returns contents of editNiso as a double


% --- Executes during object creation, after setting all properties.
function editNiso_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editNiso (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editWgt_Callback(hObject, eventdata, handles)
% hObject    handle to editWgt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editWgt as text
%        str2double(get(hObject,'String')) returns contents of editWgt as a double


% --- Executes during object creation, after setting all properties.
function editWgt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editWgt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editSpinm_Callback(hObject, eventdata, handles)
% hObject    handle to editSpinm (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editSpinm as text
%        str2double(get(hObject,'String')) returns contents of editSpinm as a double


% --- Executes during object creation, after setting all properties.
function editSpinm_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editSpinm (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editAxa_Callback(hObject, eventdata, handles)
% hObject    handle to editAxa (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editAxa as text
%        str2double(get(hObject,'String')) returns contents of editAxa as a double


% --- Executes during object creation, after setting all properties.
function editAxa_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAxa (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editAya_Callback(hObject, eventdata, handles)
% hObject    handle to editAya (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editAya as text
%        str2double(get(hObject,'String')) returns contents of editAya as a double


% --- Executes during object creation, after setting all properties.
function editAya_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAya (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editAza_Callback(hObject, eventdata, handles)
% hObject    handle to editAza (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editAza as text
%        str2double(get(hObject,'String')) returns contents of editAza as a double


% --- Executes during object creation, after setting all properties.
function editAza_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAza (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editPop_Callback(hObject, eventdata, handles)
% hObject    handle to editPop (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editPop as text
%        str2double(get(hObject,'String')) returns contents of editPop as a double


% --- Executes during object creation, after setting all properties.
function editPop_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editPop (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editArat_Callback(hObject, eventdata, handles)
% hObject    handle to editArat (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editArat as text
%        str2double(get(hObject,'String')) returns contents of editArat as a double


% --- Executes during object creation, after setting all properties.
function editArat_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editArat (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editNnit_Callback(hObject, eventdata, handles)
% hObject    handle to editNnit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editNnit as text
%        str2double(get(hObject,'String')) returns contents of editNnit as a double


% --- Executes during object creation, after setting all properties.
function editNnit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editNnit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editNpro_Callback(hObject, eventdata, handles)
% hObject    handle to editNpro (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editNpro as text
%        str2double(get(hObject,'String')) returns contents of editNpro as a double


% --- Executes during object creation, after setting all properties.
function editNpro_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editNpro (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editGxt_Callback(hObject, eventdata, handles)
% hObject    handle to editGxt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editGxt as text
%        str2double(get(hObject,'String')) returns contents of editGxt as a double


% --- Executes during object creation, after setting all properties.
function editGxt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editGxt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editGyt_Callback(hObject, eventdata, handles)
% hObject    handle to editGyt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editGyt as text
%        str2double(get(hObject,'String')) returns contents of editGyt as a double


% --- Executes during object creation, after setting all properties.
function editGyt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editGyt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editGzt_Callback(hObject, eventdata, handles)
% hObject    handle to editGzt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editGzt as text
%        str2double(get(hObject,'String')) returns contents of editGzt as a double


% --- Executes during object creation, after setting all properties.
function editGzt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editGzt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editDxt_Callback(hObject, eventdata, handles)
% hObject    handle to editDxt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editDxt as text
%        str2double(get(hObject,'String')) returns contents of editDxt as a double


% --- Executes during object creation, after setting all properties.
function editDxt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editDxt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editDyt_Callback(hObject, eventdata, handles)
% hObject    handle to editDyt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editDyt as text
%        str2double(get(hObject,'String')) returns contents of editDyt as a double


% --- Executes during object creation, after setting all properties.
function editDyt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editDyt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function editDzt_Callback(hObject, eventdata, handles)
% hObject    handle to editDzt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editDzt as text
%        str2double(get(hObject,'String')) returns contents of editDzt as a double


% --- Executes during object creation, after setting all properties.
function editDzt_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editDzt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in applyButton.
function applyButton_Callback(hObject, eventdata, handles)
% hObject    handle to applyButton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global nspex  ishape  nthe  nphim  theu  phiu
global gx  gy  gz  dx  dy  dz  spinm  axa  aya  aza  niso  wgt
global pop  arat  nnit  npro  axb  ayb  azb
global gxt  gyt  gzt  dxt  dyt  dzt  spinmt  axat  ayat  azat
global popt  aratt  nnitt  nprot  axbt  aybt  azbt  nisot  wgtt  theut  phiut
global isaveh  ilin  iiso
global flx  fly  flz  flxt  flyt  flzt  bwidemax

% hObject    handle to applyButton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
nspex = str2double(get(handles.editNspex, 'String'));
ishape = str2double(get(handles.editIshape, 'String'));
nthe = str2double(get(handles.editNthe, 'String'));
nphim = str2double(get(handles.editNphim, 'String'));
theu = str2double(get(handles.editTheu, 'String'));
gx = str2double(get(handles.editGx, 'String'));
gy = str2double(get(handles.editGy, 'String'));
gz = str2double(get(handles.editGz, 'String'));
dx = str2double(get(handles.editDx, 'String'));
dy = str2double(get(handles.editDy, 'String'));
dz = str2double(get(handles.editDz, 'String'));
spimn = str2double(get(handles.editSpinm, 'String'));
axa = str2double(get(handles.editAxa, 'String'));
aya = str2double(get(handles.editAya, 'String'));
aza = str2double(get(handles.editAza, 'String'));
isaveh = str2double(get(handles.editIsaveh, 'String'));
niso = str2double(get(handles.editNiso, 'String'));
wgt = str2double(get(handles.editWgt, 'String'));
npro = str2double(get(handles.editNpro, 'String'));
nnit = str2double(get(handles.editNnit, 'String'));
axb = str2double(get(handles.editAxb, 'String'));
ayb = str2double(get(handles.editAyb, 'String'));
azb = str2double(get(handles.editAzb, 'String'));
gxt = str2double(get(handles.editGxt, 'String'));
gyt = str2double(get(handles.editGyt, 'String'));   
gzt = str2double(get(handles.editGzt, 'String'));   
dxt = str2double(get(handles.editDxt, 'String'));
dyt = str2double(get(handles.editDyt, 'String'));
dzt = str2double(get(handles.editDzt, 'String'));
spinmt = str2double(get(handles.editSpinmt, 'String'));
axat = str2double(get(handles.editAxat, 'String'));
ayat = str2double(get(handles.editAyat, 'String'));
azat = str2double(get(handles.editAzat, 'String'));
popt = str2double(get(handles.editPopt, 'String'));
aratt = str2double(get(handles.editAratt, 'String'));
nnitt = str2double(get(handles.editNnitt, 'String'));
nprot = str2double(get(handles.editNprot, 'String'));
axbt = str2double(get(handles.editAxbt, 'String'));
aybt = str2double(get(handles.editAybt, 'String'));
azbt = str2double(get(handles.editAzbt, 'String'));
nisot = str2double(get(handles.editNisot, 'String'));
wgtt = str2double(get(handles.editWgtt, 'String'));
theut = str2double(get(handles.editTheut, 'String'));
phiut = str2double(get(handles.editPhiut, 'String')); 
ilin = str2double(get(handles.editIlin, 'String'));
iiso = str2double(get(handles.editIiso, 'String'));
flx = str2double(get(handles.editFlx, 'String'));
fly = str2double(get(handles.editFly, 'String'));
flz = str2double(get(handles.editFlz, 'String'));
flxt = str2double(get(handles.editFlxt, 'String')); 
flyt = str2double(get(handles.editFlyt, 'String'));
flzt = str2double(get(handles.editFlzt, 'String'));
bwidemax = str2double(get(handles.editBwidemax, 'String'));
filex = get(handles.dataFileName, 'String');


if isempty(filex) || strcmp(filex, 'NONE') % no experimental data
  set(handles.dataFileName, 'String', 'NONE');
  [dat, NSTEP, TSTART, DELT, FREQ, HMEAS] = nodatsr(); %run with no data
  if NSTEP == 0
    return
  end
end
set(handles.editFreq, 'String', freq);
set(handles.editField, 'String', HMEAS);

% reset the residual graph
cla(handles.residPlot, 'reset');

% xlims = xlim;
% ylims = ylim;
% maxx = xlims(2);
% maxy = ylims(2);
[y] = Monmer(npoint, hstart, hend, dhg, freq);

% Plot the data
axes(handles.dataPlot);
[X, res] = monmerplt(y, handles, 1, nstep);

guidata(hObject, handles);



% --------------------------------------------------------------------
function openData_Callback(hObject, eventdata, handles)
% hObject    handle to openData (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


global filex title
global tstart deltau nstep freq exper npoint hstart hend dhg
global para dat

filex = uigetfile('*.*', 'Enter Data File');
if filex == 0
  return
end

% Check to see if experimental data file exists (filex)
if exist(filex, 'file')
  set(handles.dataFileName, 'String', filex);
  % File exists, read it in
  [exper, npoint, hstart, hend, dhg, freq] = dataIn(filex);
  
  end
  
  % clear the residuals plot
  cla(handles.residPlot, 'reset');
  % Plot the experimental data
  hold off;
  plot(handles.dataPlot, exper);
guidata(hObject, handles);



function dataFileName_Callback(hObject, eventdata, handles)
% hObject    handle to dataFileName (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of dataFileName as text
%        str2double(get(hObject,'String')) returns contents of dataFileName as a double


% --- Executes during object creation, after setting all properties.
function dataFileName_CreateFcn(hObject, eventdata, handles)
% hObject    handle to dataFileName (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
